require "aio"

port = "/dev/ttyUSB0"

Aio::Board.new(port) do |board|
	sleep 0.1 until board.ready?
	
	print "Changing AREF to EXTERNAL: "
	if board.analogReference(Aio::EXTERNAL)
		puts "OK"
	else
		puts "ERROR"
	end
	
	print "Changing AREF back to DEFAULT: "
	if board.analogReference(Aio::DEFAULT)
		puts "OK"
	else
		puts "ERROR"
	end
end
